package factory.abstractFactory

/**
 * 应用
 */
class Application {

    private val uiFactory: UIFactory? = when (System.getProperty("os.name").toLowerCase()) {
        "windows 10" -> WindowsFactory()
        "mac" -> MacosFactory()
        else -> null
    }

    /**
     * 获取按钮
     */
    fun getButton(): Button {
        return uiFactory!!.createButton()
    }

    /**
     * 获取选框
     */
    fun getCheckBox(): CheckBox {
        return uiFactory!!.createCheckBox()
    }
}